﻿<phone:PhoneApplicationPage 
    x:Class="GPA_Calculator.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True" 
    d:DataContext="{d:DesignData Data/ScoreSample.xaml}"
    Loaded="PhoneApplicationPage_Loaded">

    
    
    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="UNIVERSITY LIFE" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="GPA Calculator" Margin="0,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="40" />
                <RowDefinition Height="240" />                
            </Grid.RowDefinitions>
            
            <!-- Grade ListBox -->
            <ListBox Name="gradeList" HorizontalAlignment="Stretch" Margin="0,0,0,0" Grid.Row="0" ItemsSource="{Binding Grades}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch">
                            <Grid HorizontalAlignment="Stretch" Width="440" >
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="80" />
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="100" />
                                </Grid.ColumnDefinitions>
                                <TextBlock Name="gradeString" Text="{Binding GradeString}" Style="{StaticResource PhoneTextLargeStyle}"  Grid.Column="0" />
                                <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Stretch">
                                    <TextBlock Name="creditString" Text="{Binding Credit}" Style="{StaticResource PhoneTextLargeStyle}" Margin="0,0,0,0" />
                                    <TextBlock Name="creditCaption" Text="Credit" Style="{StaticResource PhoneTextNormalStyle}" Margin="0,0,0,0" />
                                </StackPanel>
                                <Button Name="delButton" BorderThickness="0" Click="delButton_Click" Grid.Column="2" Background="Black" Margin="0" Width="48" Height="48" Padding="-20" >
                                    <Image Name="delButtonImage" Source="Images/appbar.cancel.rest.png" Stretch="None" Margin="0" Width="48" Height="48" />
                                </Button>
                            </Grid>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

            <!-- GPA Status TextBox -->
            <Grid Grid.Row="1" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="GPAGrid" VerticalAlignment="Stretch">
                <TextBlock Name="GPAStatusText" Text="Total # Credit(s), GPA: #.##" Style="{StaticResource PhoneTextLargeStyle}" Foreground="{StaticResource PhoneAccentBrush}" />
            </Grid>

            <Grid Grid.Row="2" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="GradePickerGrid" VerticalAlignment="Stretch">
                <Grid.RowDefinitions>
                    <RowDefinition Height="80" />
                    <RowDefinition Height="80" />
                    <RowDefinition Height="80*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="270*" />
                    <ColumnDefinition Width="186*" />
                </Grid.ColumnDefinitions>

                <!-- Credits -->
                <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2" HorizontalAlignment="Stretch">
                    <Button Content="-" Width="90" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="Zero" VerticalAlignment="Stretch" Click="subGrade_Click" />
                    <Button Content="+" Width="90" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="Plus" VerticalAlignment="Stretch" Click="subGrade_Click" />
                    <Button Content="1" Width="90" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="Credit1" VerticalAlignment="Stretch" Click="credit_Click" />
                    <Button Content="2" Width="90" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="Credit2" VerticalAlignment="Stretch" Click="credit_Click" />
                    <Button Content="3" Width="90" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="Credit3" VerticalAlignment="Stretch" Click="credit_Click" />
                </StackPanel>
                
                <!-- Grades -->
                <StackPanel Orientation="Horizontal" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" Grid.Row="1">
                    <Button Content="A" Width="90" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="A" VerticalAlignment="Stretch" Click="mainGrade_Click" />
                    <Button Content="B" Width="90" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="B" VerticalAlignment="Stretch" Click="mainGrade_Click" />
                    <Button Content="C" Width="90" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="C" VerticalAlignment="Stretch" Click="mainGrade_Click" />
                    <Button Content="D" Width="90" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="D" VerticalAlignment="Stretch" Click="mainGrade_Click" />
                    <Button Content="F" Width="90" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="F" VerticalAlignment="Stretch" Click="mainGrade_Click" />
                </StackPanel>
                <Button Content="Add" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Name="AddButton" Grid.Row="2" Grid.Column="1" Click="AddButton_Click" Margin="0,0,0,0" />
                <TextBlock Grid.Row="2" Grid.Column="0" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="gradeStatus" Text="A+ 2 Credit(s)" VerticalAlignment="Stretch" FontSize="40" Foreground="{StaticResource PhoneAccentBrush}" />
            </Grid>
        </Grid>
    </Grid>
 
    
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="Images/appbar.feature.search.rest.png" Text="About" Click="AppBarAbout_Click"/>
            <shell:ApplicationBarIconButton IconUri="Images/appbar.questionmark.rest.png" Text="How to use" Click="AppBarHowTo_Click"/>
            <shell:ApplicationBarIconButton IconUri="Images/appbar.feature.settings.rest.png" Text="Settings" Click="AppBarSettings_Click"/>
            <!--
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="About GPA Calculator"/>
                <shell:ApplicationBarMenuItem Text="How to use"/>
            </shell:ApplicationBar.MenuItems>
            -->
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>